package com.hsylient.kafka.test;

import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

@SpringBootTest
public class KafkaProducer {

    private static final String TOPIC = "my-topic";

    @Resource
    private KafkaTemplate<String, String> kafkaTemplate;

    @Test
    public void sendMessage(String message) {
        kafkaTemplate.send(TOPIC, message);
    }
}